package com.netbetter.langzheng.plugin.fileManager.widget.table;

import com.extjs.gxt.ui.client.widget.table.TableColumnModel;
import com.netbetter.langzheng.plugin.fileManager.context.ChangeListItemEventContext;
import com.netbetter.langzheng.plugin.fileManager.model.FileModel;
import com.netbetter.langzheng.plugin.fileManager.widget.menu.FileMenu;
import com.netbetter.langzheng.plugin.fileManager.widget.menu.FolderMenu;

/**
 * @author 嘉陵江里捉鱼 E-mail:tang7259@163.com
 * @Date 创建时间：2008-9-7 下午07:13:33 类说明
 */
public class ListViewTable extends LangzhengTable {

    private FolderMenu folderMenu;
    private FileMenu   fileMenu;

    public ListViewTable(TableColumnModel cm) {
        super(cm);
        folderMenu = new FolderMenu();
        fileMenu = new FileMenu();
    }

    @Override
    protected void update() {
        FileModel fileModel = ChangeListItemEventContext.getFileModel();
        if (fileModel != null) {
            if (fileModel.getIsDirectory()) {
                this.setContextMenu(folderMenu);
            } else {
                this.setContextMenu(fileMenu);
            }
        }

    }

}
